
#ifndef _ERROR_H
#define _ERROR_H
#include <windows.h>
#include "..\common\string.h"
#include "..\common\def.h"

const int ERRORREPORT_LOG = 1; 
const int ERRORREPORT_NOTIFY = 2; 
const int ERRORREPORT_ALL = ERRORREPORT_LOG | ERRORREPORT_NOTIFY; 

#define EE_ERROR(message) { CError::CError(message, __LINE__, __FILE__);  }
#define EE_LOGERROR(message) { CError::CError(message, __LINE__, __FILE__,ERRORREPORT_LOG );  }
#define EE_EXCEPTION(message) CError::CErrorData(__LINE__, __FILE__,message); 

class EE_EXPORT CError
{
public:

	struct CErrorData
	{
		int		mLine; 
		char*	mpFile; 
		char*	mpMessage; 

		CErrorData(int line, char* file, char* message) : mLine(line), mpFile(file), mpMessage(message)
		{	}
		CErrorData() : mLine(-1), mpFile(NULL), mpMessage(NULL)
		{	}
	}; 

	static void NotifyError(string &errorDescription); 
	static void LogError(string &errorDescription); 
	static void Error(string &errorDescription); 

	static void NotifyError(const char* errorDescription); 
	static void LogError(const char* errorDescription); 
	static void Error(const char* errorDescription); 

	CError(const char* errorDescription,const int line, const char* file, const int flags = ERRORREPORT_ALL); 
	CError(const char* errorDescription, const int flags = ERRORREPORT_ALL); 
	CError(CErrorData& data, const int flags = ERRORREPORT_ALL); 
	CError(); 

}; 
#endif
